//
//  BLOnsaleTableViewCell.m
//  blanket
//
//  Created by Mac on 2017/12/5.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "BLOnsaleTableViewCell.h"
@interface BLOnsaleTableViewCell()
@property(nonatomic, strong) UIImageView                     *backImageView;
@property(nonatomic, strong) STLabel                         *titleLable;
@property(nonatomic, strong) STLabel                         *timeLable;
@property(nonatomic, strong) STLabel                         *descLable;
@end
@implementation BLOnsaleTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 120;
}
#pragma mark --subView
- (void)configSubView{
    self.backImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 0, UIScreenWidth - 30, [BLOnsaleTableViewCell cellHeight])];
    self.backImageView.image = [UIImage imageNamed:@"优惠券2"];
    self.backImageView.layer.cornerRadius = 10;
    self.backImageView.clipsToBounds = YES;
    [self addSubview:self.backImageView];
    
    [self addSubview:self.backImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(30, 20, 200, 16)
                                                     text:@"布草定制"
                                                textColor:BL_firstTextColor
                                                     font:15
                                              isSizetoFit:NO
                                            textAlignment:NSTextAlignmentLeft];
    [self.backImageView addSubview:self.titleLable];
    
    self.timeLable = [[STLabel alloc] initWithFrame:CGRectMake(30, 20, 200, 16)
                                                text:@"2017年12月05日14:25:06"
                                           textColor:BL_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    self.timeLable.centerY = [BLOnsaleTableViewCell cellHeight]/2;
    [self.backImageView addSubview:self.timeLable];
    
    
    self.descLable = [[STLabel alloc] initWithFrame:CGRectMake(30, 0, 120, [BLOnsaleTableViewCell cellHeight])
                                               text:@"单笔消费满\n￥500\n送10元"
                                          textColor:[UIColor whiteColor]
                                               font:13
                                        isSizetoFit:NO
                                      textAlignment:NSTextAlignmentCenter];
    self.descLable.right = self.backImageView.width;
    self.descLable.numberOfLines = 0;
    [self.backImageView addSubview:self.descLable];
    self.descLable.attributedText = [self.descLable.text st_convertAttributeStringWithKeyWord:@"￥500"
                                                                                   attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:18]}];
    
}
@end
